#pragma once

// All JSON transformations (Compressed JSON -> Uncompressed, Analytical-Model compatible JSON)
// In-place transform is not tested
// Based on Boost.Json

#include <algorithm/analytical_model/io/json/transform/Tags.h>

#include <boost/json.hpp>

namespace solar::io::json
{
    void transformScenePara(const DeCompressTag&, const boost::json::value& sun_value,
                            boost::json::value& scene_para_value);

    /// \brief Transform Cylinder to Cylinder3D
    /// Actually we don't use Cylinder in analytical-model, we use Cylinder3D instead
    void transformCylinder(const TransformTag&, const boost::json::value& cylinder_value,
                           const boost::json::value& position_value,
                           boost::json::value& cylinder3d_value);

    /// \brief Transform Rectangle to Rectangle3D
    /// Actually we don't use Rectangle in analytical-model, we use Rectangle3D instead
    void transformRectangle(const TransformTag&, const boost::json::value& rectangle_value,
                            const boost::json::value& position_value,
                            const boost::json::value& normal_value, double thickness,
                            boost::json::value& rectangle3d_value);

    void transformSimulationPara(const DeCompressTag&, const boost::json::value& simulation_value,
                                 boost::json::value& simulation_para_value);

    void transformCommonPara(const DeCompressTag&, const boost::json::value& simulation_value,
                             boost::json::value& common_para_value);

    void transformRectangleGrid(const TransformTag&, const boost::json::value& grid_value,
                                boost::json::value& rectangle_grid_value);

    /// \note We don't handle heliostat's geometry here
    void transformHeliostat(const DeCompressTag&, const boost::json::value& gap_value,
                            const boost::json::value& subhelio_row_col_value, double thickness,
                            bool has_brace, boost::json::value& heliostat_value);

    void transformHeliostatPara(const DeCompressTag&, const boost::json::value& material_value,
                                boost::json::value& heliostat_para_value);
} // namespace solar::io::json
